package com.kd.controller.jobSeeker;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageInfo;
import com.kd.bean.jobSeeker.My_news;
import com.kd.bean.recruiter.Recruiter_basic;
import com.kd.service.jobSeeker.IMy_newsService;

/**
 * 求职者相关的类 --求职者-招聘者->我的消息（My_newsController）--
 * @author ZFC
 *
 */
@Controller
@RequestMapping("/my_news")
public class My_newsController {

	@Autowired
	private IMy_newsService newService;
	
	@RequestMapping("/queryAllNews_visit_stateMy_news")
	@ResponseBody
	public PageInfo<My_news> queryAllNews_visit_stateMy_news(Integer pageNum,Integer pageSize,HttpSession session){
		//查询所有 求职者给招聘者发送的消息访问状态 1、未访问 2、以访问 3、删除（状态修改

		PageInfo<My_news> info = null;
		try {
			Recruiter_basic basic = (Recruiter_basic) session.getAttribute("basicMsg");
			info = newService.queryAllNews_visit_stateMy_news(pageNum, pageSize,basic.getRecruiter_id());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return info;
	}
	@RequestMapping("/updateNews_visit_state")
	@ResponseBody
	public Boolean updateNews_visit_state(Integer news_id,Integer news_visit_state) {
		//修改消息状态 2、以访问 3、删除（状态修改

		Boolean flag = false;
		try {
			flag = newService.updateNews_visit_state(news_id, news_visit_state);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return flag;
	}
}
